home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / wb-tools / iconian / macros / add.icrx next >
Encoding:
Text File  |  1995-09-20  |  1.1 KB  |  55 lines

  1. /* An example REXX script for Iconian */
  2.  
  3. /* Pretty useless macro, really,
  4.    all it does is draw a 11x11 box around
  5.    the mouse cursor, adding 1 to the value
  6.    of each pixel.  Is smart enough to wrap
  7.    the last color of the scree to color 0.*/
  8.  
  9. /* PS: Expect this script to take LOTS and LOTS of time! */
  10.  
  11. address 'ICONIAN.1'
  12. options results
  13.  
  14. /* grab current mouse coords */
  15. 'getcoord x'
  16. mx=result
  17. 'getcoord y'
  18. my=result
  19.  
  20. /* Lock the GUI so the user can interfere! */
  21. lockgui
  22.  
  23. /* Ask for the screen depth */
  24. 'getscreendepth'
  25. depth=result
  26.  
  27. /* Now, convert that to the number of colors */
  28. /* (Is there an easier way? Can rexx do a SHL? */
  29. IF depth=1 THEN numofcolors=2
  30. IF depth=2 THEN numofcolors=4
  31. IF depth=3 THEN numofcolors=8
  32. IF depth=4 THEN numofcolors=16
  33. IF depth=5 THEN numofcolors=32
  34. IF depth=6 THEN numofcolors=64
  35. IF depth=7 THEN numofcolors=128
  36. IF depth=8 THEN numofcolors=256
  37.  
  38. numofcolors=numofcolors-1
  39.  
  40. /* do a loop, -5 to +5 and -5 to +5 */
  41.  
  42. Do t=my-5 to my+5
  43.   Do i=mx-5 to mx+5
  44.     getpixel i t
  45.     pen=result
  46.     pen=pen+1
  47.     If pen>numofcolors Then pen=0
  48.     setfgcolor pen
  49.     plot i t
  50.     END
  51.   END
  52.  
  53. /* Let go of the GUI. */
  54. unlockgui
  55.